package gateway.internal.config.impl;

import gateway.config.ConnectorConfig;
import gateway.config.FilterConfig;
import gateway.config.InboundConfig;
import gateway.config.OutboundConfig;
import gateway.config.RouteConfig;

import java.util.List;

/**
 * @author Jin Zheng
 * @since 1.0 2020-09-15
 */
public class DefaultRouteConfig extends DefaultIdConfig implements RouteConfig
{
	private int order;
	private ConnectorConfig connector;
	private InboundConfig inbound;
	private List<FilterConfig> filters;
	private OutboundConfig outbound;

	public DefaultRouteConfig()
	{
	}

	@Override
	public int order()
	{
		return order;
	}

	@Override
	public ConnectorConfig connector()
	{
		return connector;
	}

	@Override
	public InboundConfig inbound()
	{
		return inbound;
	}

	@Override
	public List<FilterConfig> filters()
	{
		return filters == null ? List.of() : List.copyOf(filters);
	}

	@Override
	public OutboundConfig outbound()
	{
		return outbound;
	}

	public void setOrder(int order)
	{
		this.order = order;
	}

	public void setConnector(ConnectorConfig connector)
	{
		this.connector = connector;
	}

	public void setInbound(InboundConfig inbound)
	{
		this.inbound = inbound;
	}

	public void setFilters(List<FilterConfig> filters)
	{
		this.filters = filters;
	}

	public void setOutbound(OutboundConfig outbound)
	{
		this.outbound = outbound;
	}
}
